package pro.shushi.pamirs.demo.api.model;

import pro.shushi.pamirs.demo.api.enumeration.ItemStatusEnum;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.common.CodeModel;
import pro.shushi.pamirs.meta.enmu.DateFormatEnum;
import pro.shushi.pamirs.meta.enmu.DateTypeEnum;
import pro.shushi.pamirs.user.api.model.PamirsUser;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * code的生成规则可指定类型：pro.shushi.pamirs.meta.enmu.SequenceEnum
 */
@Model.model(DemoPurchaseOrder.MODEL_MODEL)
@Model(displayName = "测试采购订单", labelFields = "name")
@Model.Code(sequence = "SEQ", prefix = "PO", size = 8)
public class DemoPurchaseOrder extends CodeModel {

    private static final long serialVersionUID = -5104390780952631397L;

    public static final String MODEL_MODEL = "demo.DemoPurchaseOrder";

    @Field.String
    @Field(displayName = "客户姓名")
    private String userName;

    @Field.String
    @Field(displayName = "客户手机")
    private String phone;

    @Field.Money
    @Field(displayName = "订单总价")
    private BigDecimal totalAmount;

    @Field.one2many
    @Field(displayName = "订单明细")
    @Field.Relation(relationFields = "id",referenceFields = "purchaseOrderId")
    private List<DemoPurchaseDetail> details;

    @Field.Integer
    @Field(displayName = "买家ID")
    private Long userId;

    @Field.many2one
    @Field.Relation(relationFields = {"userId"}, referenceFields = {"id"})
    @Field(displayName = "买家")
    private PamirsUser user;

    @Field.Integer
    @Field(displayName = "买家喜欢类目")
    private Long categoryId;

    @Field.many2one
    @Field.Relation(relationFields = {"categoryId"}, referenceFields = {"id"})
    @Field(displayName = "买家喜欢类目")
    private DemoItemCategory userCategory;
}
